private int centerx, centery, lengthx, lengthy,width,type;
private double angle;
private Color color,border;
/**
* Constructs a needle.
* @param in_color The color
* @param in_border The color of the border (the border is 1 pixel wide)
* @param in_type The type (0=no Needle, 1=Triangle, 2=Rectangle, 3=Romb)
* @param in_width The witdh
* @param in_centerx The x-cord of the center
* @param in_centery The y-cord of the center
* @param in_lengthx The length in the x-axis
* @param in_lengthy The lenght in the y-axis
* @param in_angle The angle (0=To the right, pi=To the left)
*/
public Needle(Color in_color, Color in_border,int in_type,int in_width,int in_centerx, int in_centery, int in_lengthx, int in_lengthy, double in_angle)
{
color=in_color; // The color
border=in_border; // The color of the border (1 pixel width)
type=in_type; // The type (0=no Needle, 1=Triangle, 2=Rectangle, 3=Romb)
width=in_width; // The witdh
centerx=in_centerx; // The x-cord of the center
centery=in_centery; // The y-cord of the center
lengthx=in_lengthx; // The length in the x-axis
lengthy=in_lengthy; // The lenght in the y-axis
angle=in_angle; // The angle (0=To the right, pi=To the left)
}
/**
* Sets the angle of the needle.
* @param in_angle The needle's new angle. (0=To the right, pi/2 Up, pi=Left, 3pi/2 Down)
*/
public void setAngle(double in_angle)
{
angle=in_angle;
}
/**
* Draws the needle on a graphics object.
* @param g The graphics object which the needle will be drawn upon.